{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEWCAYAAAB1xKBvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcXHWZ7/HPlyyQhSWQZpEkJCD7lkgTqMggEVlHibgC\ngsDIRL04V8e5OqP3KgrDvQ7qODoiCpgLjCwioGaEAeI1BDQE0mEPa4hAEpCsELIAWZ77x+8UXel0\ndZ9OuvpUdX/fr9d5VZ21nqpO6qnfehQRmJmZdWabogMwM7PG4IRhZma5OGGYmVkuThhmZpaLE4aZ\nmeXihGFmZrk4YRgAkkLSu2tw3VWS9q7Bdb8l6RfdfM3/knRuB/uvkfTPW3H98yT9cUvP7+JrvfP3\n3Nq460l3vpda/Bvq7ZwwehFJx0iaKel1Scsl/UnSkT34+vdIuqByW0QMjYj5PRXD1oiIUyLiWtj6\nL3dJo7Mv7f7dF+Em1/+WpHVZQi4vr9XitbZE9t4XV75/SQOybbkGf/VkgrV8nDB6CUk7AL8D/h3Y\nGdgT+DbwVpFxWU39MkvI5WWnogNqYwVwSsX6Kdk2a1BOGL3HfgARcWNEbIiItRFxd0Q8Vj5A0t9I\nekrSCkl3SdqrvQtJ2lbS9yS9JOlVST+VNKhi/yRJj0haKel5SSdLuhT4K+DH2a/dH2fHtq0auVzS\n7ZLekPSApH0qrnuipGeyEtJPJM1oW2KpEu8ASTdKulXSwDb7xkh6TdI22fpVkhZX7P8PSV/Knt8j\n6QJJBwI/BUrt/HIfVi3+Nu7NHl/LrlGqeM3vZX+DP0s6pWL7jpJ+LukVSYsk/bOkfp29/5yGS5qW\nxT2j8m8vaYKk2dnnPlvShGz7REmPVxw3TdLsivX7JH24g9f8D+DTFeufBq6rPKDae97Sv0G195Lt\nG5O99zckTQOG5/3wLBMRXnrBAuwALAOuJf2SG9Zm/yRgHnAg0B/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KiL+AiyQtH+26XjSVDz14kzqpDoq8xJw\ntKTB2f/P40lti4WTtGv2OIrUfnFDrV6r4ac331qSbgSOA4ZLWghcFBE/LzYq3gucAzyetRcAfD2b\naqVIewDXZr1XtgFujoi66sJah3YDfp2+Y+gP3BARdxYb0jv+Drg+q/6ZD5xfcDzAO4n1BOCzRcdS\nFhEPSLoFeIg0v93D1M80IbdK2gVYR5p3r2adF/p8t1ozM8vHVVJmZpaLE4aZmeXihGFmZrk4YZiZ\nWS5OGGZmlosThlkNSRpdTzMhm20NJwwzM8vFCcOsh0jaO5vo78iiYzHbEn1+pLdZT8im4LgJOC8i\nHi06HrMt4YRhVntNwG+BjxR9EyyzreEqKbPae500ed0xRQditjVcwjCrvbeB04G7JK2KiJrNJmpW\nS04YZj0gIlZnN3qaliWNqUXHZNZVnq3WzMxycRuGmZnl4oRhZma5OGGYmVkuThhmZpaLE4aZmeXi\nhGFmZrk4YZiZWS7/H5rYADrNfZ5/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f04541c9c10>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np \n",
    "from sklearn.cluster import KMeans \n",
    "from scipy.spatial.distance import cdist \n",
    "import matplotlib.pyplot as plt \n",
    "\n",
    "c1x = np.random.uniform(0.5, 1.5, (1, 10)) \n",
    "c1y = np.random.uniform(0.5, 1.5, (1, 10)) \n",
    "c2x = np.random.uniform(3.5, 4.5, (1, 10)) \n",
    "c2y = np.random.uniform(3.5, 4.5, (1, 10)) \n",
    "x = np.hstack((c1x, c2x)) \n",
    "y = np.hstack((c1y, c2y)) \n",
    "X = np.vstack((x, y)).T \n",
    "\n",
    "K = range(1, 10) \n",
    "meanDispersions = [] \n",
    "for k in K: \n",
    "    kmeans = KMeans(n_clusters=k) \n",
    "    kmeans.fit(X) \n",
    "    meanDispersions.append(sum(np.min(cdist(X, kmeans.cluster_centers_, 'euclidean'), axis=1)) / X.shape[0]) \n",
    "\n",
    "plt.plot(K, meanDispersions, 'bx-') \n",
    "plt.xlabel('k') \n",
    "plt.ylabel('Average Dispersion') \n",
    "plt.title('Selecting k with the Elbow Method') \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
